﻿#pragma once
struct _stTerrainTypeInfo;

struct _stTerrainIDInfo
{
	const _stTerrainTypeInfo* pTerrainTypeInfo;	// 指向TerrainTypeInfo::m_mapTerrainTypeInfo
	BYTE nColor;		// 用于map的key
	BYTE nPriority;		// 优先级
	_stTerrainIDInfo(){ clear(); }
	void clear(){	// 数据清空
		pTerrainTypeInfo = nullptr; nColor = 0; nPriority = 0;
	}
	bool empty() const;	// 是否是空数据
};

class CTerrainIDInfo
{
	friend class CScriptDataMgr;	// 只有CScriptDataMgr能实例化这个类

public:
	const _stTerrainIDInfo* GetInfoCPtr(BYTE KeyIn) const;	// 通过key取得m_mapTerrainIDInfo存储的信息 没有则insert一个空数据

	~CTerrainIDInfo() = default;
private:
	CTerrainIDInfo() = default;
	CTerrainIDInfo(const CTerrainIDInfo&) = delete;
	CTerrainIDInfo& operator=(const CTerrainIDInfo&) = delete;

	bool IsDataComplete() const;	// 检查map中所有数据是否都不为空

	std::unordered_map<BYTE, _stTerrainIDInfo> m_mapTerrainIDInfo;	// Key:8位地形图的每个点的值
};